jQuery.prototype.serializeObject=function(){  
    var obj=new Object();  
    $.each(this.serializeArray(),function(index,param){  
        if(!(param.name in obj)){  
            obj[param.name]=param.value;  
        }  
    });  
    return obj;  
}; 


jQuery.prototype.serializeJsonStr=function(){  
    var obj="{";  
    
    var flag = false;
    
    $.each(this.serializeArray(),function(index,param){  
    	if(flag){
    		obj += ",";
    	}else{
    		flag = true;
    	}
        obj +=  "\""+param.name+"\":\""+param.value+"\"";
    });  
    obj += "}";
    
    console.log(obj);
    return obj;  
}; 




function doGet(url , data){
	return httpAjax ("get" , url , false , data);
}


function doPost(url , data){
	return httpAjax ("post" , url , false , data);
}




function httpAjax(type , url , sync , data ){
	var result = null;
	
	$.ajax({
	    type: type,
	    url: url ,
	    async: sync,
	    data: data ,
	    dataType: "json",
	    success:function(msg){
	    	console.log(msg);
	    	result = msg; 
	    }
	});
	return result;
}